package com.example.zhinongbao.provider;

import android.net.Uri;
import android.provider.BaseColumns;

public final class ZhinongbaoContract {
    private ZhinongbaoContract() {}

    public static final String AUTHORITY = "com.example.zhinongbao.provider";
    public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY);

    // 产品表
    public static class Products implements BaseColumns {
        public static final String TABLE_NAME = "products";
        public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, TABLE_NAME);

        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_PRICE = "price";
        public static final String COLUMN_DESCRIPTION = "description";
        public static final String COLUMN_CREATED_AT = "created_at";
    }
    // 在ZhinongbaoContract类中添加
    public static final class Users implements BaseColumns {
        public static final String TABLE_NAME = "users";
        public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, TABLE_NAME);

        public static final String COLUMN_USERNAME = "username";
        public static final String COLUMN_PASSWORD = "password";
        public static final String COLUMN_AVATAR = "avatar";
        public static final String COLUMN_PHONE = "phone";
        public static final String COLUMN_EMAIL = "email";
        public static final String COLUMN_TYPE = "type"; // 0:买家 1:卖家
        public static final String COLUMN_CREATE_TIME = "create_time";
    }
    public static final class NewsEntry implements BaseColumns {
        public static final String TABLE_NAME = "news";
        public static final String COLUMN_TITLE = "title";
        public static final String COLUMN_CONTENT = "content";
        public static final String COLUMN_IMAGE_URL = "image_url";
        public static final String COLUMN_CREATED_AT = "created_at";
        public static final String COLUMN_USER_ID = "user_id";
        public static final String COLUMN_IS_PUBLISHED = "is_published";
    }
    // 添加农友圈表定义
        public static class FriendCircle implements BaseColumns {
            public static final String TABLE_NAME = "friend_circle";
            public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, TABLE_NAME);
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd." + AUTHORITY + ".friendcircle";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd." + AUTHORITY + ".friendcircle";
            public static final String COLUMN_CONTENT = "content";
            public static final String COLUMN_IMAGES = "images";
            public static final String COLUMN_USER_ID = "user_id";
            public static final String COLUMN_USER_NAME = "user_name";
            public static final String COLUMN_USER_AVATAR = "user_avatar";
            public static final String COLUMN_CREATE_TIME = "create_time";
            public static final String COLUMN_TYPE = "type";
            public static final String COLUMN_IS_FOLLOWED = "is_followed";
        public static final String COLUMN_IS_LIKED = "is_liked"; // 新增点赞状态字段
        public static final String COLUMN_LIKE_COUNT = "like_count";
        public static final String COLUMN_IMAGE_DATA = "image_data";
            public static final int TYPE_LATEST = 0;
            public static final int TYPE_FOLLOWING = 1;


        public static final String COLUMN_COMMENT_COUNT ="comment_count";
    }

    // 添加用户关注表定义
    public static final class UserFollow implements BaseColumns {
        public static final String TABLE_NAME = "user_follow";
        public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, TABLE_NAME);
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.zhinongbao.userfollow";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.zhinongbao.userfollow";

        public static final String COLUMN_USER_ID = "user_id";
        public static final String COLUMN_FOLLOW_ID = "follow_id";
        public static final String COLUMN_CREATE_TIME = "create_time";
    }
    // 消息表
    public static class Messages implements BaseColumns {
        public static final String TABLE_NAME = "messages";
        public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, TABLE_NAME);
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.zhinongbao.message";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.zhinongbao.message";

        public static final String COLUMN_CONTENT = "content";
        public static final String COLUMN_TIMESTAMP = "timestamp";
        public static final String COLUMN_IS_SENT = "is_sent"; // 0: 接收, 1: 发送
        public static final String COLUMN_USER_ID = "user_id"; // 新增用户ID字段
        public static final String COLUMN_TITLE = "title";
        public static final String COLUMN_CREATE_TIME ="create time" ;
    }

    // 足迹表
    public static class FootprintEntry implements BaseColumns {
        public static final String TABLE_NAME = "footprints";
        public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, TABLE_NAME);
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.zhinongbao.footprint";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.zhinongbao.footprint";

        public static final String COLUMN_PRODUCT_ID = "product_id";
        public static final String COLUMN_TIMESTAMP = "timestamp";
        public static final String COLUMN_USER_ID = "user_id"; // 新增用户ID字段
    }

    // 订单表（完整实现）
    public static final class Orders implements BaseColumns {
        // 表名
        public static final String TABLE_NAME = "orders";
        // CONTENT_URI
        public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, TABLE_NAME);
        // MIME类型
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.zhinongbao.order";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.zhinongbao.order";

        // 列名
        public static final String COLUMN_ORDER_ID = "order_id"; // 新增唯一订单ID
        public static final String COLUMN_USER_ID = "user_id";
        public static final String COLUMN_PRODUCT_ID = "product_id";
        public static final String COLUMN_PRODUCT_NAME = "product_name";
        public static final String COLUMN_QUANTITY = "quantity";
        public static final String COLUMN_PRICE = "price";
        public static final String COLUMN_TOTAL_AMOUNT = "total_amount";
        public static final String COLUMN_STATUS = "status";
        public static final String COLUMN_ORDER_DATE = "order_date";
        public static final String COLUMN_ADDRESS = "address";
        public static final String COLUMN_PAYMENT_METHOD = "payment_method";
        public static final String COLUMN_CREATED_AT = "created_at"; // 新增创建时间字段

        // 订单状态常量
        public static final String STATUS_PENDING_PAYMENT = "待付款";
        public static final String STATUS_PENDING_SHIPMENT = "待发货";
        public static final String STATUS_PENDING_RECEIPT = "待收货";
        public static final String STATUS_PENDING_REVIEW = "待评价";
        public static final String STATUS_REFUND_AFTERSALE = "退款/售后";
    }
}